package com.bba.fms.common.ezspecial.util;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.regex.Pattern;

/**
 * @BelongsProject: fms
 * @Author: 王志鹏
 * @CreateTime: 2019-10-14 09:26
 * @description: 校验判断
 */
public class VerifyUtil {
    private  VerifyUtil(){}

    /**
     * 校验字符串否包含在数组中
     * @param check
     * @param v
     * @return
     */
    public static boolean cheekCustomize(String[] check, String v) {

        return Arrays.asList(check).contains(v);
    }

    /**
     * 根据正则表达式进行校验
     * @param regular
     * @param v
     * @return
     */
    public static boolean checkByRegular(String regular, String v) {

        if (StringUtils.isEmpty(v)) return false;
        return Pattern.matches(regular, v);
    }
}
